package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsRegRegionTbl;
import com.auxgroup.hr.front.dao.repository.PsRegRegionTblRepository;
import com.auxgroup.hr.front.service.personnal.RegRegionTblService;

/** 
 * @author wangchangyun
 * @version 创建时间：180527 
 * 社保公积金service
 */
@Service("regRegionTblService")
public class RegRegionTblServiceImpl implements RegRegionTblService {
	
	@Autowired
	private PsRegRegionTblRepository PsRegRegionTblRepository;


	@Override
	@Cacheable(value="REGREGION_VALUE",key="#regRegion")
	public PsRegRegionTbl getRegRegionTbl(String regRegion) {
		PsRegRegionTbl regRegiontbl = new PsRegRegionTbl();
		regRegiontbl.setRegRegion(regRegion);
		List<PsRegRegionTbl> regions = PsRegRegionTblRepository.findAll(Example.of(regRegiontbl));
		if(regions!=null&&!regions.isEmpty()){
			return regions.get(0);
		}
		return null;
	}
	
	@Override
	@Cacheable(value="REGREGION_LIST")
	public List<PsRegRegionTbl> getAll() {
		PsRegRegionTbl RegRegionTbl = new PsRegRegionTbl();
		return PsRegRegionTblRepository.findAll(Example.of(RegRegionTbl));
	}


	
	
	
}
